package com.ljx.thread.thread04;

import lombok.Data;

/**
 * @author LJX
 * @Description: TODO
 * @Date: 2022/11/1 16:28
 * @Version 1.0
 */
@Data
class BoyThread extends Thread{
	private DeadLockChop deadLockChop;
	public BoyThread(DeadLockChop deadLockChop){
		this.deadLockChop=deadLockChop;
	}

	@Override
	public void run() {
		synchronized (deadLockChop.getLeftChopsticks()){

			System.out.println("男孩获取左筷子");
			synchronized (deadLockChop.getRightChopsticks()){
				System.out.println("男孩获取右筷子");
			}
		}
	}
}
